home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / include / pnm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-10  |  2.7 KB  |  77 lines

  1. /* pnm.h - header file for libpnm portable anymap library
  2. */
  3.  
  4. #ifndef _PNM_H_
  5. #define _PNM_H_
  6.  
  7. #ifdef PPM
  8.  
  9. #include "ppm.h"
  10. typedef pixel xel;
  11. typedef pixval xelval;
  12. #define PNM_MAXMAXVAL PPM_MAXMAXVAL
  13. #define PNM_GET1(x) PPM_GETB(x)
  14. #define PNM_ASSIGN1(x,v) PPM_ASSIGN(x,0,0,v)
  15. #define PNM_EQUAL(x,y) PPM_EQUAL(x,y)
  16. #define PNM_FORMAT_TYPE(f) PPM_FORMAT_TYPE(f)
  17.  
  18. #else /*PPM*/
  19. # ifdef PGM
  20.  
  21. #include "pgm.h"
  22. typedef gray xel;
  23. typedef gray xelval;
  24. #define PNM_MAXMAXVAL PGM_MAXMAXVAL
  25. #define PNM_GET1(x) (x)
  26. #define PNM_ASSIGN1(x,v) (x) = (v)
  27. #define PNM_EQUAL(x,y) ( (x) == (y) )
  28. #define PNM_FORMAT_TYPE(f) PGM_FORMAT_TYPE(f)
  29.  
  30. # else /*PGM*/
  31. #  ifdef PBM
  32.  
  33. #include "pbm.h"
  34. typedef bit xel;
  35. typedef bit xelval;
  36. #define PNM_MAXMAXVAL 1
  37. #define PNM_GET1(x) (x)
  38. #define PNM_ASSIGN1(x,v) (x) = (v)
  39. #define PNM_EQUAL(x,y) ( (x) == (y) )
  40. #define PNM_FORMAT_TYPE(f) PBM_FORMAT_TYPE(f)
  41.  
  42. #  endif /*PBM*/
  43. # endif /*PGM*/
  44. #endif /*PPM*/
  45.  
  46. /* Declarations of routines. */
  47.  
  48. void pnm_init ARGS(( int* argcP, char* argv[] ));
  49.  
  50. #define pnm_allocarray( cols, rows ) ((xel**) pm_allocarray( cols, rows, sizeof(xel) ))
  51. #define pnm_allocrow( cols ) ((xel*) pm_allocrow( cols, sizeof(xel) ))
  52. #define pnm_freearray( xels, rows ) pm_freearray( (char**) xels, rows )
  53. #define pnm_freerow( xelrow ) pm_freerow( (char*) xelrow )
  54.  
  55. xel** pnm_readpnm ARGS(( FILE* file, int* colsP, int* rowsP, xelval* maxvalP, int* formatP ));
  56. void pnm_readpnminit ARGS(( FILE* file, int* colsP, int* rowsP, xelval* maxvalP, int* formatP ));
  57. void pnm_readpnmrow ARGS(( FILE* file, xel* xelrow, int cols, xelval maxval, int format ));
  58.  
  59. void pnm_writepnm ARGS(( FILE* file, xel** xels, int cols, int rows, xelval maxval, int format, int forceplain ));
  60. void pnm_writepnminit ARGS(( FILE* file, int cols, int rows, xelval maxval, int format, int forceplain ));
  61. void pnm_writepnmrow ARGS(( FILE* file, xel* xelrow, int cols, xelval maxval, int format, int forceplain ));
  62.  
  63. xel pnm_backgroundxel ARGS(( xel** xels, int cols, int rows, xelval maxval, int format ));
  64. xel pnm_backgroundxelrow ARGS(( xel* xelrow, int cols, xelval maxval, int format ));
  65. xel pnm_whitexel ARGS(( xelval maxval, int format ));
  66. xel pnm_blackxel ARGS(( xelval maxval, int format ));
  67. void pnm_invertxel ARGS(( xel* x, xelval maxval, int format ));
  68. void pnm_promoteformat ARGS(( xel** xels, int cols, int rows, xelval maxval, int format, xelval newmaxval, int newformat ));
  69. void pnm_promoteformatrow ARGS(( xel* xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat ));
  70.  
  71. extern xelval pnm_pbmmaxval;
  72. /* This is the maxval used when a PNM program reads a PBM file.  Normally
  73. ** it is 1; however, for some programs, a larger value gives better results
  74. */
  75.  
  76. #endif /*_PNM_H_*/
  77.